/* 
 * File:   Model.h
 * Author: mvdr
 *
 * Created on March 19, 2013, 3:01 PM
 */

#ifndef MODEL_H
#define	MODEL_H

#include <stdlib.h>
#include <vector>
#include "State.h"

class Model {
    
    std::vector<State> d_states;
    bool ***d_relations;
    bool ***d_startRelations;
    
public:
    Model();    
    virtual ~Model();
    
    void initRelations();
    size_t numberOfStates() const;
    State const &stateAt(size_t idx) const;
    void cutOff(size_t idx, size_t player);
    bool playerKnowsState(size_t player, size_t idx) const;
    size_t playerConsidersPossible(size_t player, size_t idx) const;
    //size_t knownStates(size_t p) const;
    bool playerConsidersStatePossible(size_t player, size_t i, size_t j) const;
    void printPossibleStates(int p, int s) const;
    
private:
    
    void buildStates();
    void buildRelations();       
    
    void combine(std::vector<std::vector<char> > all, std::vector<char> left,
        size_t k, int curP);
    
    void switchPlayer(std::vector<std::vector<char> > all, size_t k, int curP);

};

inline size_t Model::numberOfStates() const {
    return d_states.size();
}

inline State const &Model::stateAt(size_t idx) const {
    return d_states[idx];
}

#endif	/* MODEL_H */

